<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>

    <!-- 
    1.小括号
    2.支持解构
    3.in === of(js迭代器)
 -->
    <div id="box">
        <ul>
            <li v-for="({title,state},index) of datalist">
                {{title}}---{{index}}
                <div v-if="state===0">
                    <b>未付款</b>
                </div>
                <div v-else-if="state===1">
                    <b>待发货</b>
                </div>
                <div v-else-if="state===2">
                    <b>已完成</b>
                </div>
                <div v-else>
                    <b>已取消</b>
                </div>
            </li>

        </ul>


    </div>
    <script>
        var obj = {
                data() {
                    return {
                        datalist: [{
                            title: '手机',
                            state: 0
                        }, {
                            title: '电脑',
                            state: 1
                        }, {
                            title: '鼠标',
                            state: 2
                        }, {
                            title: '键盘',
                            state: 3
                        }]
                    }
                },

            }
            // 创建vue实例
        var app = Vue.createApp(obj).mount('#box')
    </script>
</body>

</html>